package com.xxx.Lock;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/8/2  11:09
 * @Copyright
 */
public class DeadKock implements Runnable {
    private Object lock1 = new Object();

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "Deadklock01开始执行");
        synchronized (Test.lock1) {
            System.out.println(Thread.currentThread().getName() + "Deadklock01 锁住了lock");
            try {
                Thread.sleep(1000 * 60);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            synchronized (Test.obj2) {
                System.out.println(Thread.currentThread().getName() + "Deadklock01锁住obj2");
                try {
                    Thread.sleep(1000 * 60);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
